#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

struct Point
{
	double x, y;
	Point () {}
	Point (double _x, double _y) : x(_x), y(_y) {}
	Point operator + (Point a)
	{
		return Point(x + a.x, y + a.y);
	}
	Point operator - (Point a)
	{
		return Point(x - a.x, y - a.y);
	}
	double operator * (Point a)
	{
		return x * a.y - y * a.x;
	}
	double operator % (Point a)
	{
		return x * a.x + y * a.y;
	}
	void scan()
	{
		scanf("%lf%lf", &x, &y);
	}
	void print()
	{
		printf("%lf %lf\n", x, y);
	}
};

const int N = (int)1e5 + 10;
Point p[N];
vector <int> g[N];

double getAngle(Point A, Point B, Point C)
{
	Point v = A - B;
	Point u = C - A;
	return fabs(atan2(v * u, v % u));
}

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		p[i].scan();

	for (int i = 0; i < m; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}

	double ans = 0;
	for (int i = 0; i < n; i++)
	{
		double minAngle = 1e9;
		for (int pairFirst = 1; pairFirst < (int)g[i].size(); pairFirst++)
		{
			double angle1 = getAngle(p[i], p[g[i][0]], p[g[i][pairFirst]]);
			double angle2 = 0;
			Point A, B;
			int cnt = 0;
			for (int q = 1; q < (int)g[i].size(); q++)
			{
				if (q == pairFirst)
					continue;
				if (cnt == 0)
					A = p[g[i][q]];
				else
					B = p[g[i][q]];
				cnt++;
			}
			if (cnt == 2)
				angle2 = getAngle(p[i], A, B);
			minAngle = min(minAngle, angle1 + angle2);
		}
		ans += minAngle;
	}
	printf("%.10lf", ans);
	return 0;
}
